package com.y.simple.entity;

import java.io.Serializable;

import com.y.simple.global.ResultException;

import io.swagger.v3.oas.annotations.media.Schema;

/**
 * <p>
 * 
 * </p>
 *
 * @author y2014188432
 * @since 2023-05-13
 */
@Schema(name = "User对象", description = "")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(name = "主键ID")
    private Long id;

    @Schema(name = "姓名")
    private String name;

    @Schema(name = "年龄")
    private Integer age;

    @Schema(name = "邮箱")
    private String email;

    public static void validator(User user) {
        if (user.getAge() < 18) {
            throw new ResultException("403","年龄不得小于18");
        }
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    public String toString() {
        return "User{" +
            "id=" + id +
            ", name=" + name +
            ", age=" + age +
            ", email=" + email +
        "}";
    }
}
